<html>
<head>
	<meta charset='utf-8' />
	<title>商城后台</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<style>
		@media screen and (max-width:450px){
			#content,.Nav_bottom,#Back_Btn{width:98%;margin:0 auto}

			/*页面宽度900以下时 .abc的宽度为450*/
		}
		@media screen and (min-width:450px){
			#content,.Nav_bottom,#Back_Btn{width:450px;margin:0 auto}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
	</style>
</head>
<body style='padding:0;margin:0;background:#eaa'>

	<!-- 1 content容器 -->
	<div id='content' style=''>
		<div style='text-align:right;padding:10px;font-size:12px'>
			当前地区：<span id='Admin_User_County' style='color:green'>　</span>　
			管理员：<span id='adminUserName' style='color:green'></span>　
			<span style='color:blue' id='Admin_Exit'>退出</span>
		</div>
		

		<!--各分页加载区-->
		<div id='loadArea'></div>
		<div id='updatePwd'></div>


	</div><!-- 1 Content容器结束 -->


	<!-- 等待提示框 -->
	<div id='Notice'></div>


	<!--空间隔离元素-->
	<div style='margin-bottom:45px'></div>

	<!--底部导航容器-->
	<div style='position:fixed;bottom:0;width:100%'>
		<div class='Nav_bottom'>
			<select id="Main_Nav" style='width:100%'>
				<!--option value="Main_Index">欢迎页</option>
				<option value="Main_Domain">后台服务器管理</option>
				<option value="Main_City">开通城市管理</option>
				<option value="Main_AdminUser">后台成员管理</option>
				<option value="Main_GoodsType">商品类别管理</option>
				<option value="Main_Store">商户管理</option>
				<option value="Main_Goods">商品管理</option>
				<option value="Main_FreeGoods">砍价商品管理</option>
				<option value="Main_Set">其它设置</option-->
			</select>
		</div>
	</div><!--底部导航容器结束-->


	<!--地区切换的显示-->
	<div id='Main_CityChangeViewArea' ></div>

</body>
</html>


<script src='../Public/jquery.js'></script>
<script src='../Public/fun.js'></script>

<script>


//var main_data = new Object();
// var main_expire = 5000;
// var main_psize = 3;   //默认每页条数

var maxPage;	//通用最大页
var pnow = 1;	//通用当前页

var userInfo = _getAdminUserInfo();


$(function(){

	//显示当前登陆用户
	$('#adminUserName').text(userInfo.name).click(function(){
		if(admin_user_name == userInfo.name){	//超管不需要重置密码
			return;
		}
		Ajax({},function(res){
			$('#loadArea').hide();
			$('#updatePwd').html(res).show();
		},'Template/Main_update_pwd.html');
	});

	
	//加载底部导航
	var bottonNavStr = '';
		bottonNavStr += "<option value='Main_Index'>欢迎页</option>";
		if(userInfo.name == admin_user_name){
			bottonNavStr += "<option value='Main_Domain'>后台服务器管理</option>";
			bottonNavStr += "<option value='Main_OpenCity'>开通城市管理</option>";
			bottonNavStr += "<option value='Main_AdminUser'>后台成员管理</option>";
			bottonNavStr += "<option value='Main_GoodsType'>商品类别管理</option>";
		}
		bottonNavStr += "<option value='Main_Store'>商户管理</option>";
		bottonNavStr += "<option value='Main_Goods'>商品管理</option>";
		bottonNavStr += "<option value='Main_FreeGoods'>砍价商品管理</option>";
		bottonNavStr += "<option value='Main_FreeGoodsOrder'>砍价订单管理</option>";
		bottonNavStr += "<option value='Main_Set'>其它设置</option>";

	$('#Main_Nav').html(bottonNavStr);

	//底部导航状态维持
	if(sessionStorage.admin_bottomNavPageName){
		$('#Main_Nav').val(sessionStorage.admin_bottomNavPageName);
	}
	//加载底导选择的页面
	_loadPage();

	//底部导航切换
	$('#Main_Nav').change(function(){

		_loadPage();
		//$('#MainGoods_SearchInp').val('');	//清空商品搜索值
		//Clear_MainGoodsPnowOrMax(); 	//重置商品列表面的当前页和最大页的值
		//sessionStorage.StoreToGoodsList_Id = '';  //清除商户跳转商品列表时的id缓存
	});

	//显示当前选择城市
	if(sessionStorage.admin_currentSelectCountyInfo){
		$('#Admin_User_County').text(_getCurrentCityInfo()[3]);
	}
	


	
	// ### 账户退出退出按钮
	$('#Admin_Exit').click(function(){
		AjaxAdmin({'type':'AdminExit'},function(res){
			sessionStorage.clear();
			location.replace('index.html');
		});

	});


	$('#Admin_User_County').click(function(){
		if(!confirm('确定要切换城市？')){
			return;
		}
		//重置商户审核页面的页码
			sessionStorage.MainStore_Pnow = 1;
			sessionStorage.MainStore_MaxPage = 2;
		location.replace('city.html');
	});
});



//重置商品列表面的当前页和最大页的值
function resetPnowAndMax(){
	pnow = 1;
	maxPage = '';
}



//加载底导选择的页面
function _loadPage(){
	var pageName = $('#Main_Nav').find('option:selected').val();

	switch(pageName){
		case 'Main_Store':
		case 'Main_Goods':
		case 'Main_FreeGoods':
			if(!sessionStorage.admin_currentSelectCountyInfo){
				A('请先选择一个地区！');err
			}
		break;
	}

	sessionStorage.admin_bottomNavPageName = pageName;
	Ajax('',function(res){
	 	$('#loadArea').html(res);
	},'Template/'+pageName+'.html',1);
}



</script>

